import { getStoarge } from "@/utils/storage.js";
export default {
  namespaced: true, //命名空间
  state: {
    goodsLength: 0,
  },
  mutations: {
    getGoodsLength(state) {
      state.goodsLength = 0;
      let shopCarList = getStoarge("shopCarList")
        ? getStoarge("shopCarList")
        : [];
      if (shopCarList.length) {
        shopCarList.forEach((item) => {
          state.goodsLength += item.num;
        });
      }
    },
  },
};
